package ca.jsbr.as2js_lib.display.canvas.view 
{
	import ca.jsbr.as2js_lib.display.canvas.View;
	/**
	 * ...
	 * @author jsbr [me@jsbr.ca]
	 */
	public class StackView extends View 
	{
		private var _views:Vector.<View>;
		private var _current:int = 0;
		
		public function StackView() 
		{
			_views = new Vector.<View>();
		}
		
		
		public function addView(view:View):void
		{
			if (_views.length == _current)
				view.visible = true;
			else
				view.visible = false;
			_views.push(view);
			addChild(view);
		}
		
		public function display(id):void
		{
			_views[_current].visible = false;
			_views[id].visible = true;
			_current = id;
		}
		
		
	}

}